<%@page import="sosr.serveur.IServeurRMI"%>
<%@page import="base.Base"%>
<%@page import="sosr.bean.Medecin"%>
<div class="main" >
<jsp:useBean id="logon" scope="session" class="bean.Connexion"></jsp:useBean>
<jsp:useBean id="pageConfig" scope="session" class="bean.Page"></jsp:useBean>
<style type="text/css">
<!--
.main {width: 400px;}
-->
</style>
<%

String msg = "";

if (request.getParameter("valide") != null) {
	String login = request.getParameter("login");
	String passwd = request.getParameter("passwd");
	logon.setLogin(login);
	logon.setPasswd(passwd);
	if (!logon.isConnect()) {
		logon.setMessage("Impossible d'identifier l'utilisateur");
	}
	else {
		IServeurRMI serv = logon.getSrvRMI();
		serv.open();
		Medecin medecin = serv.selectMedecin(login);
		pageConfig.setMedecin(medecin);
		serv.close();
	}
}

response.sendRedirect("../index.jsp");

%>
<div id="logo" ></div>
<form name="logonform" method="post" action="pages/logon.jsp" class="logonform" id="logonForm">
	<div align="center">
		<table>
			<tbody>
				<tr>
					<td>Login</td><td><input type="text" name="login" value="" title="Votre identifiant ou login" /></td>
				</tr>
				<tr>
					<td>Mot de passe</td><td><input type="password" name="passwd" value="" title="Votre mot de passe" /></td>
				</tr>
				<tr>
					<td colspan="2" style="color: #f00;"><%=logon.getMessage() %>&nbsp;</td>
				</tr>
				<tr>
					<td colspan="2" style="text-align: center">
						<input type="image" src="images/ihm/login.png" 
								onmouseover="this.src='images/ihm/login_active.png'" 
								onmouseout="this.src='images/ihm/login.png'" 
								name="valide" title="Connexion" value="Connexion" />
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
</div>

